package com.gyx.lottery.dao.mapper;

import com.gyx.lottery.dao.dataobject.ActivityDO;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface ActivityMapper {
    @Insert("insert into activity (activity_name,description,status) values " +
            " (#{activityName},#{description},#{status})")
    @Options(useGeneratedKeys = true,keyProperty = "id",keyColumn = "id")
    void insert(ActivityDO activityDO);
    @Select("select count(*) from activity")
    Integer count();
    @Select("select * from activity limit #{offset},#{limit}")
    List<ActivityDO> selectByPage(@Param("offset") Integer offset, @Param("limit") Integer limit);
@Select("select * from activity where id=#{activityId}")
    ActivityDO selectById(@Param("activityId") Long activityId);
    @Update("update activity set status=#{status} where id=#{id}")
    void updateStatusById(@Param("id")Long activityId, @Param("status")String status);
}
